<%include file="header.html"%>
<%include file="top.html"%>
<%include file="left.html"%>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
	<li><i class="icon-home home-icon"></i> <a
		href="index.php">首页</a></li>
</ul>
					</div>

				<div class="page-content">

						<div class="row">
				
	<div id="pcDevice" style="display:block" class="col-xs-12">
<div class="alert alert-info">
<form class="form-horizontal" role="form">
<div class="row">
<div class="col-sm-4">
<div class="row">
<label class="col-sm-3 control-label no-padding-right" for="form-field-5">游戏</label>
<div class="col-sm-3"><select id="selectGame">
	<option value="" >游戏</option>
	<%if $selectGames%> <%foreach from = $selectGames key = key item = value%>
	<%if $nowGame == $value %>
	<option value="<%$value%>" selected><%$value%></option>
	<%else%>
	<option value="<%$value%>"><%$value%></option>
	<%/if%> <%/foreach%> <%/if%>
</select>
</div>
</div>
</div>

<div class="col-sm-4">
<div class="row">
<label class="col-sm-3 control-label no-padding-right" for="form-field-5">活动</label>
<div class="col-sm-3">
<select id="activity">
	<option value="">活动</option>
	<%if $activitys%> <%foreach from = $activitys key = key item = value%>
	<%if $nowActivityId == $value.id %>
	<option value="<%$value.id%>" selected><%$value.name%></option>
	<%else%>
	<option value="<%$value.id%>"><%$value.name%></option>
	<%/if%> <%/foreach%> <%/if%>
	
</select>
</div>
</div>
</div>

<!--  
<div class="col-sm-2">
<div class="row">
<label class="col-sm-3 control-label no-padding-right" for="form-field-5">平台</label>
<div class="col-sm-3">
<select id="platform">
	<option value="" id="selectPlatform">平台</option>
	
	<%if $platforms%> <%foreach from = $platforms key = key item = value%>
	<%if $platform == $value %>
	<option value="<%$value%>" selected><%$value%></option>
	<%else%>
	<option value="<%$value%>"><%$value%></option>
	<%/if%> <%/foreach%> <%/if%>
	
</select>
</div>
</div>
</div>


<div class="col-sm-2">
<div class="row">
<label class="col-sm-3 control-label no-padding-right" for="form-field-5">渠道</label>
<div class="col-sm-3">
<select id="channel">
	<option value="" id="selectChannel2">渠道</option>
	<%if $channels%> <%foreach from = $channels key = key item = value%>
	<%if $channel == $value %>
	<option value="<%$value%>" selected><%$value%></option>
	<%else%>
	<option value="<%$value%>"><%$value%></option>
	<%/if%> <%/foreach%> <%/if%>
</select>
</div>
</div>
</div>

<div class="col-sm-2">
<div class="row"><label
	class="col-sm-3 control-label no-padding-right" for="form-field-5">开始</label>
<div class="col-sm-9">
<div class="input-group"><span class="input-group-addon"> <i
	class="icon-calendar bigger-110"></i> </span> <input
	class="date-picker col-xs-12 col-sm-12" id="startTime"
	value="<%$startDate%>" type="text" data-date-format="yyyy-mm-dd" /></div>
</div>
</div>
</div>

<div class="col-sm-2">
<div class="row"><label
	class="col-sm-3 control-label no-padding-right" for="form-field-5">截止</label>
<div class="col-sm-9">
<div class="input-group"><span class="input-group-addon"> <i
	class="icon-calendar bigger-110"></i> </span> <input
	class="date-picker col-xs-12 col-sm-12" id="endTime"
	value="<%$endDate%>" type="text" data-date-format="yyyy-mm-dd" /></div>
</div>
</div>
</div>
-->
<div class="col-sm-4">
<div class="col-sm-12">
<center>
<button type="button" onClick="formSubmit('pc');"
	class="width-25 btn btn-sm btn-primary">查询</button>
</center>
</div>
</div>
</div>
</form>
</div>
</div>			
				
				



<div id="moveDevice" style="display:none" class="col-xs-12">
<div class="alert alert-info">
<form class="form-horizontal" role="form">
<div class="row">
<div class="col-sm-12">
<div class="row">
<label class="col-sm-5 control-label no-padding-right" for="form-field-5">游戏</label>
<div class="col-sm-3"><select id="selectGame2">
	<option value="" >游戏</option>
	<%if $selectGames%> <%foreach from = $selectGames key = key item = value%>
	<%if $nowGame == $value %>
	<option value="<%$value%>" selected><%$value%></option>
	<%else%>
	<option value="<%$value%>"><%$value%></option>
	<%/if%> <%/foreach%> <%/if%>
</select>
</div>
</div>
</div>

<div class="col-sm-12">
<div  class="row">
<label class="col-sm-5 control-label no-padding-right" for="form-field-5"></label>
</div>
</div>

<div class="col-sm-12">
<div class="row">
<label class="col-sm-5 control-label no-padding-right" for="form-field-5">平台</label>
<div class="col-sm-3">
<select id="platform2">
	<option value="" id="selectPlatform2">平台</option>
	
	<%if $platforms%> <%foreach from = $platforms key = key item = value%>
	<%if $platform == $value %>
	<option value="<%$value%>" selected><%$value%></option>
	<%else%>
	<option value="<%$value%>"><%$value%></option>
	<%/if%> <%/foreach%> <%/if%>
	
</select>
</div>
</div>
</div>

<div class="col-sm-12">
<div  class="row">
<label class="col-sm-5 control-label no-padding-right" for="form-field-5"></label>
</div>
</div>

<div class="col-sm-12">
<div class="row">
<label class="col-sm-5 control-label no-padding-right" for="form-field-5">渠道</label>
<div class="col-sm-3">
<select id="channel2">
	<option value="" id="selectChannel2">渠道</option>
	<%if $channels%> <%foreach from = $channels key = key item = value%>
	<%if $channel == $value %>
	<option value="<%$value%>" selected><%$value%></option>
	<%else%>
	<option value="<%$value%>"><%$value%></option>
	<%/if%> <%/foreach%> <%/if%>
</select>
</div>
</div>
</div>
<div class="col-sm-12">
<div  class="row">
<label class="col-sm-5 control-label no-padding-right" for="form-field-5"></label>
</div>
</div>

<div class="col-sm-12">
<div class="row"><label
	class="col-sm-5 control-label no-padding-right" for="form-field-5">开始</label>
<div class="col-sm-3">
<div class="input-group"><span class="input-group-addon"> <i
	class="icon-calendar bigger-110"></i> </span> <input
	class="date-picker col-xs-12 col-sm-12" id="startTime2"
	value="<%$startDate%>" type="text" data-date-format="yyyy-mm-dd" /></div>
</div>
</div>
</div>

<div class="col-sm-12">
<div  class="row">
<label class="col-sm-5 control-label no-padding-right" for="form-field-5"></label>
</div>
</div>

<div class="col-sm-12">
<div class="row"><label
	class="col-sm-5 control-label no-padding-right" for="form-field-5">截止</label>
<div class="col-sm-3">
<div class="input-group"><span class="input-group-addon"> <i
	class="icon-calendar bigger-110"></i> </span> <input
	class="date-picker col-xs-12 col-sm-12" id="endTime2"
	value="<%$endDate%>" type="text" data-date-format="yyyy-mm-dd" /></div>
</div>
</div>
</div>

<div class="col-sm-12">
<div  class="row">
<label class="col-sm-5 control-label no-padding-right" for="form-field-5"></label>
</div>
</div>

<div class="col-sm-12">
<div class="col-sm-12">
<center>
<button type="button" onClick="formSubmit('move');"
	class="width-15 btn btn-sm btn-primary">查询</button>
</center>
</div>
</div>
</div>
</form>
</div>
</div>

	
<div class="col-xs-12">

<%if $action && $action == 1%>
<div class="table-header">
饼状图
</div>

<div class="row">					
	<div class="col-sm-12">
		<div class="widget-box transparent">
			<div class="widget-body">
				<div class="position-relative">
							<div id="container" style="min-width:400px;height:300px"></div>
				</div><!-- /position-relative -->
			</div><!-- /widget-body -->
		</div><!-- /widget-box -->
	</div>					
	 					
</div><!-- /row -->
<%/if%>

<div id="view1" class="table-responsive">
<div class="table-header">
活动效果信息
</div>
<table id="sample-table-2"
	class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th>活动期号</th>
			<th>总参与人数</th>
			<th>钻石收益</th>

		</tr>
	</thead>
	<tbody>
		<%foreach from=$dataArr item=data%>
		<tr>
			<td><%$data.activityno%></td>
			<td><%$data.puidcount%></td>
			<td><%$data.goldconsume%></td>
		</tr>
		<%/foreach%>

	</tbody>
</table>
</div>
</div>


<!-- /.table-responsive --></div>
</div>
<!-- /.page-content --></div>
<!-- /.main-content -->
				
				
<script type="text/javascript">

	
	jQuery(function($) {
	
		$('.date-picker').datepicker({
			autoclose : true
		}).next().on(ace.click_event, function() {
			$(this).prev().focus();
		});
	
		var oTable1 = $('#sample-table-1').dataTable({
			"aoColumns" : [ {
				"bSortable" : false
			} 
			]
		});
	
	});
	
	
	function formSubmit(device) {
		var game = $('#selectGame').val();
		var activityId = $('#activity').val();
		
		if(!game) {
			alert("请选择游戏");
		}
		
		if(!activityId) {
			alert("请选择活动");
		}
		
		url = "index.php?mod=DataAnalysis&do=activityEffect&game="
			+ game
			+ "&activityId="
			+ activityId
			+ "&action=1";
			
		// 请求数据
		window.location.href = url;
	}
	
	
	jQuery(function($) {
		$('.date-picker').datepicker({autoclose:true}).next().on(ace.click_event, function(){
			$(this).prev().focus();
		});
	});
		

	window.onload = function(){
		
/*		var width = document.documentElement.clientWidth;
		if(width < 1300) {
			$('#pcDevice').css("display", "none");
			$('#moveDevice').css("display", "block");
		} else if(width > 1300) {
			$('#pcDevice').css("display", "block");
			$('#moveDevice').css("display", "none");
		}
*/		
	    
	    var select2 = document.getElementById('selectGame');
	    select2.onchange = function(){
	        // 更改值后执行的代码
	       var gameName = jQuery("#selectGame  option:selected").text();
	       $.ajax({
	    	    type: "POST",
				url: "index.php?mod=Game&do=getActivityByGame&game=" + gameName,
				data: "",
				dataType: 'html',
				success: function(data) {					
					var dataObj = eval("(" + data + ")");//转换为json对象
					
					if(dataObj == null) {
						$("#activity").empty();
						$("#activity").append('<option value="" id="selectPlatform2">平台</option>');
					}
					var activityId = dataObj.activityId;
					var activityName = dataObj.activityName;
					
					$("#activity").empty();
					$("#activity").append('<option value="" >活动</option>');
					for(var i=0;i< activityId.length;i++){
						$("#activity").append("<option value='"+activityId[i]+"' >"+activityName[i]+"</option>"+"<br/>");
					}
				}
	       });
	    }
	} 
	
	<%if $viewData%>
	// 饼状图
	$(function () {
	    $('#container').highcharts({
	        chart: {
	            plotBackgroundColor: null,
	            plotBorderWidth: null,
	            plotShadow: false
	        },
	        title: {
	            text: '新手步骤分布图'
	        },
	        tooltip: {
	    	    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
	        },
	        plotOptions: {
	            pie: {
	                allowPointSelect: true,
	                cursor: 'pointer',
	                dataLabels: {
	                    enabled: true,
	                    color: '#000000',
	                    connectorColor: '#000000',
	                    format: '<b>{point.name}</b>: {point.percentage:.2f} %'
	                }
	            }
	        },
	        series: [{
	            type: 'pie',
	            name: 'Browser share',
	            data: <%$viewData%>
	        /*    data: [
	                ['Firefox',   50.00],
	                ['IE',       26.8],
	                ['Chrome',    12.8],
	                ['Safari',    8.5],
	                ['Opera',     6.2],
	                ['Others',   50.00]
	            ]
	       */
	        }]
	    });
	});	
	<%/if%>
	
</script>							
<%include file="footer.html"%>

